<?php

	class Default_Form_Login extends Zend_Form
	{
		private $_action;
		
		public function __construct($action)
		{
			$this->_action = $action;
			
			parent::__construct();
		}
		
		public function init()
		{
			$this->setAction($this->_action);
			$this->setMethod('post');
			$this->setAttrib('class','form');
			
			$username = new Zend_Form_Element_Text('username');
			$username->setLabel(Zend_Registry::get('translate')->_('USERNAME').':')
				 ->setRequired(true)
				 ->addValidator('NotEmpty', true)
				 ->addValidator('regex', true, array(Default_Model_Validator::getUsernameExp()))
				 ->removeDecorator('Errors');
				 
				 
			$pw1 = new Zend_Form_Element_Password('password');
			$pw1->setLabel(Zend_Registry::get('translate')->_('PASSWORD').':')
				 ->setRequired(true)
				 ->addValidator('NotEmpty', true)
				 ->addValidator('regex', true, array(Default_Model_Validator::getPasswordExp()))
				 ->removeDecorator('Errors');
			
			$submit = new Zend_Form_Element_Submit('submit');
			$submit->setLabel(Zend_Registry::get('translate')->_('LOGIN'));
			
			
			$elements = array($username,$pw1,$submit);
				
			$this->addElements($elements);
			  
			$this->setDisableLoadDefaultDecorators(true);
			
			$this->addDecorator('FormElements')
				 ->addDecorator('HtmlTag',array('tag' => 'ul'))
				 ->addDecorator('Form');
				 
			$this->setElementDecorators(array(
				'ViewHelper',
				'Label',
				new Zend_Form_Decorator_HtmlTag(array('tag' => 'li'))
				
			));
			
			$submit->removeDecorator('Label');
		}
	}